projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
413978d
)
mmc: Protect `mmc_initialize` from initialising mmc multiple times
author
Daniel Kochmański
<
[email protected]
>
Fri, 29 May 2015 14:55:43 +0000
(16:55 +0200)
committer
Hans de Goede
<
[email protected]
>
Fri, 24 Jul 2015 14:17:08 +0000
(16:17 +0200)
`mmc_initialize` might be called multiple times leading to the mmc-controllers
being initialised twice, and initialising the `mmc_devices` list head twice
which may lead to memory leaks.
Signed-off-by: Daniel Kochmański <
[email protected]
>
CC: Roy Spliet <
[email protected]
>
Cc: Ian Campbell <
[email protected]
>
CC: Pantelis Antoniou <
[email protected]
>
Acked-by: Hans de Goede <
[email protected]
>
Signed-off-by: Hans de Goede <
[email protected]
>
drivers/mmc/mmc.c
patch
|
blob
|
history
diff --git
a/drivers/mmc/mmc.c
b/drivers/mmc/mmc.c
index da47037a3066260a5596d35c1cf033f7102c2afe..f12546ac51925a9e249ffb1a8fbdf8cd6f91ea04 100644
(file)
--- a/
drivers/mmc/mmc.c
+++ b/
drivers/mmc/mmc.c
@@
-1762,6
+1762,11
@@
static void do_preinit(void)
int mmc_initialize(bd_t *bis)
{
+ static int initialized = 0;
+ if (initialized) /* Avoid initializing mmc multiple times */
+ return 0;
+ initialized = 1;
+
INIT_LIST_HEAD (&mmc_devices);
cur_dev_num = 0;